import Vue from 'vue'
import Router from 'vue-router'
//懒加载组件（当路由被访问的时候才加载对应组件，而不是在首页就全部加载，以此来提高首页反应速度）
const HelloWorld = r => { require.ensure([], () => { r(require('@/components/HelloWorld')) }, 'HelloWorld') };
const test = r => { require.ensure([], () => { r(require('@/views/test/test')) }, 'test') };
const animation = r => { require.ensure([], () => { r(require('@/views/animation')) }, 'animation') };
const search = r => { require.ensure([], () => { r(require('@/views/search')) }, 'search') };
// import home from '@/views/home/home'

Vue.use(Router)

export default new Router({
  // mode: 'history',
  routes: [
    {
      path: '/',
      name: 'HelloWorld',
      component: HelloWorld
    },
    {
      path: '/home',
      name: 'home',
      component: () => import('@/views/home/home')
    },
    {
      path: '/test',
      name: 'test',
      component: test
    },
    {
      path: '/animation',
      name: 'animation',
      component: animation
    },
    {
      path: '/search',
      name: 'search',
      component: search
    },
  ]
})
